//
// Created by PC on 2023/9/4.
// 仅使用位运算计算减法
//


#include <iostream>
#include <ctime>

using namespace std;


int add(int a, int b)
{
    int aa = a;
    while (b)
    {
        aa = a ^ b;
        b = (a & b) << 1;
        a = aa;
    }
    return a;
}

int subtract(int a, int b)
{
    int negative_b = (~b) + 1;
    return add(a, negative_b);
}

int main()
{
    int one = 9, two = 50;
    srand((int) time(0));
    one = rand();
    two = rand();
//    cout<<one<<endl;
//    cout<<two<<endl;
    int t = 1000;
    while (t--)
    {
        if (subtract(one, two) != (one - two))
        {
            cout << one << endl;
            cout << two << endl;
        }
    }
    return 0;
}